function setCookie(name, value, day) {
    let date = new Date();
    date.setDate(date.getDate() + day);
    document.cookie = name + "=" + value + ";expires=" + date;
}

function getCookie(name) {
    let reg = RegExp(name + "=([^;]+)");
    let arr = document.cookie.match(reg);
    if (arr) {
        return arr[1];
    } else {
        return "";
    }
}

function delCookie(name) {
    setCookie(name, null, -1);
}

export default {
    set: setCookie,
    get: getCookie,
    del: delCookie,
};

